/**
 *  ConstLocation.java : IceBird project
 *  17:24:47 
 */
package icebird.compiler.ncomp.vs;

import icebird.metadata.BasicType;

/**
 * @author Sergey Shulepoff[Knott]
 */
public abstract class ConstLocation extends Location {

	/**
	 * @param name
	 */
	protected ConstLocation(String dta) {
		super("Const: " + dta);
	}

	/* (non-Javadoc)
	 * @see icebird.compiler.ncomp.vs.Location#getWeight()
	 */
	public final int getWeight() {
		return 1; // The best performance!
	}
	
	/**
	 * Returns type of constant.
	 * @return BasicType
	 */
	public abstract BasicType getType();
	
	/**
	 * Create integer constant.
	 * @return IntegerConstantLocation
	 */
	public static IntegerConstantLocation createIConst(int i) {
		return new IntegerConstantLocation(i);
	}
	
	/**
	 * Create long constant.
	 * @return LongConstantLocation
	 */
	public static LongConstantLocation createLConst(long l) {
		return new LongConstantLocation(l);
	}
	
	/**
	 * Create float constant.
	 * @return FloatConstantLocation
	 */
	public static FloatConstantLocation createFConst(float f) {
		return new FloatConstantLocation(f);
	}
	
	/**
	 * Create double constant.
	 * @return DoubleConstantLocation
	 */
	public static DoubleConstantLocation createDConst(double d) {
		return new DoubleConstantLocation(d);
	}
}
